package com.xx.job.controller.system;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xx.job.common.PageResult;
import com.xx.job.common.Result;
import com.xx.job.controller.dto.PageDTO;
import com.xx.job.entity.system.SysOperaLog;
import com.xx.job.service.system.SysOperaLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import com.xx.job.controller.base.BaseController;

import javax.xml.ws.soap.Addressing;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangcy
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/api/v1")
public class SysOperaLogController extends BaseController {

    @Autowired
    private SysOperaLogService sysOperaLogService;

    @RequestMapping("/operloglist")
    public Result operloglist(PageDTO pageDTO, SysOperaLog sysOperaLog){
        IPage<SysOperaLog> sysOperaLogIPage = sysOperaLogService.selectPage(pageDTO, sysOperaLog);
        return Result.success(new PageResult(sysOperaLogIPage));
    }

    @PostMapping("/operlog")
    public Result addOperlog(@RequestBody SysOperaLog sysOperaLog){
        return Result.success(sysOperaLogService.add(sysOperaLog));
    }

    @DeleteMapping("/operlog/{id}")
    public Result deleteOperlog(@PathVariable Long id){
        return Result.success(sysOperaLogService.delete(id));
    }

    @PutMapping("/operlog")
    public Result updateOperlog(@RequestBody SysOperaLog sysOperaLog){
        return Result.success(sysOperaLogService.update(sysOperaLog));
    }

    @GetMapping("/operlog/{id}")
    public Result selectOperlog(@PathVariable Long id){
        return Result.success(sysOperaLogService.select(id));
    }

}

